home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / clang / ebksrc.zip / PCCURSOR.HPP < prev    next >
C/C++ Source or Header  |  1991-07-30  |  1KB  |  55 lines

  1. /*
  2.  
  3.     pccursor.hpp
  4.     7-30-91
  5.     Cursor shape class for IBM PC text modes.
  6.  
  7.     Copyright 1991
  8.     John W. Small
  9.     All rights reserved
  10.     Use freely but acknowledge authorship and copyright.
  11.  
  12.     PSW / Power SoftWare
  13.     P.O. Box 10072
  14.     McLean, Virginia 22102 8072 USA
  15.  
  16.     John Small
  17.     Voice : (703) 759-3838
  18.     CIS: 73757,2233
  19.  
  20. */
  21.  
  22. #ifndef PCCURSOR_HPP
  23. #define PCCURSOR_HPP
  24.  
  25. #include <dos.h>
  26.  
  27. class CursorShape {
  28.     unsigned origshape, prevshape;
  29. protected:
  30.     enum {
  31.         CursorOffMask        =    0x2000,
  32.         CursorOnMask        =    0xDFFF,
  33.         BlockCursorMask        =    0x00FF,
  34.         DefaultColorCursor    =    0x0607,
  35.         DefaultMonoCursor    =    0x0C0D
  36.     };
  37.     unsigned  getshape() { _BH = 0x00; _AH = 0x03;
  38.         geninterrupt(0x10); return _CX; }
  39.     void putshape(unsigned shape);
  40.     unsigned defaultshape() { _AH = 0x0F;
  41.         geninterrupt(0x10); return (_AL == 7)?
  42.         DefaultMonoCursor : DefaultColorCursor; }
  43. public:
  44.     void off() { putshape(getshape() | CursorOffMask); }
  45.     void on()  { putshape(getshape() & CursorOnMask); }
  46.     void block() { putshape(defaultshape() & BlockCursorMask); }
  47.     void normal()  { putshape(defaultshape()); }
  48.     void save()    { prevshape = getshape(); }
  49.     void restore() { putshape(prevshape); }
  50.     void saveOrig()  { origshape = getshape(); }
  51.     void restoreOrig() { putshape(origshape); }
  52. };
  53.  
  54. #endif
  55.